<%= render 'menu/caidauadmin'%>

<p style="color: green"><%= label_tag params[:alert1] %></p>
<div>
<table >
	<tr>
		<td style="vertical-align:text-top;">
			<fieldset align="left">
			<legend><h2>Search Engine</h2></legend>
			
			<%= form_tag :action => "search_process" do%>
				<table>
					<tr>
						<td>Id:</td>	
						<td><%= text_field_tag "id"%></td>	
					</tr>
					<tr>
						<td>Name:</td>	
						<td><%= text_field_tag "name"%></td>	
					</tr>
					<tr>
						<td>Author:</td>	
						<td><%= text_field_tag "author"%></td>	
					</tr>
					<tr>
						<td>Genre:</td>	
						<td><%= text_field_tag "genre"%></td>	
					</tr>
					<tr>
						<td>Publish Year:</td>	
						<td><%= text_field_tag "publish_year"%></td>	
					</tr>
					
				</table>
				  <br />
				<%= submit_tag "ok"%> <br /> <br />
			<% end %>
			<%= @notice %> <br /> <br />
			<%= link_to 'Previous', { :action=>'change_page' , :type=>-1} %> 
			Display from <%=(@from+1)%> to <%=(@to+1) %>
			 <%= link_to 'Next', { :action=>'change_page' , :type=>1} %>
			<br /> <br />
			</fieldset>
		</td>
		<td>
			
<table class="vienxanh">
  <tr>
    <th>Id</th>
    <th>Name</th>
    <th>Author</th>
    <th>Genre</th>
    <th>Publish Year</th>
    <th>Quantity</th>
    <th>Available</th>
    <th>Description</th>
    <th colspan="2">Action</th>
  </tr>

<% 
		
		for i in @from..@to
			
	%>
	<% r=@result[i] %>
  <tr>
    <td><%= r.id %></td>
    <td><%= link_to r.Name, {:controller => "search",:action => 'show_process', :id => r.id} %></td>
    <td><%= r.Author %></td>
    <td><%= r.Genre %></td>
    <td><%= r.Publish_year %></td>
    <td><%= r.Quantity %></td>
    <td><%= r.Available_quantity %></td>
    <td><%= r.Description %></td>
    <td> <%= link_to 'Edit', {:action => 'editbook',:id => r.id} %> </td>
    <td> <%= link_to 'Delete', {:action => 'deletebook', :id => r.id} %> </td>
  </tr>
<% end %>
<br />
<%= link_to 'Add new book', {:action => 'newbook'} %>




</div>